import time
def bbsort(massiv, n):
    for i in range(n-1):
        for j in range(n-i-1):
            if massiv[j]>massiv[j+1]:
                massiv[j], massiv[j+1]=massiv[j+1], massiv[j]
                
def rl(filename):
    file=open(filename, 'r')
    data=file.readlines()
    return data

b=rl("m1_sorted.txt")
raz=len(b)
t_start=time.time()
bbsort(b,raz)
t_finish=time.time()
print("m1_sorted ", round((t_finish-t_start)*1000),"milisecond")

b1=rl("m2_reverse.txt")
raz1=len(b)
t_start1=time.time()
bbsort(b,raz)
t_finish1=time.time()
print("m2_reverse ", round((t_finish1-t_start1)*1000),"milisecond")

b2=rl("m3_shuffle.txt")
raz2=len(b)
t_start2=time.time()
bbsort(b,raz)
t_finish2=time.time()
print("m3_shuffle ", round((t_finish2-t_start2)*1000),"milisecond")
